using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace GameUI {

	public class ActionSkillIconController:MonoBehaviour {
		void Start() {
			image=GetComponent<Image>();
		}

		void Update() {
			ActionSkill actionSkill = Player.instance.actionSkill.actionSkill;
			if(actionSkill==null) image.sprite=defaultSprite;
			else {
				int actionSkillId = actionSkill.id;
				int displaySpriteIndex = 0;

				if(actionSkill.activated) displaySpriteIndex=2;
				else if(actionSkill.available) displaySpriteIndex=1;
				else displaySpriteIndex=0;

				image.sprite=ActionSkillManager.actionSkillData[actionSkillId].sprites[displaySpriteIndex];
			}
		}

		[SerializeField] Sprite defaultSprite;
		Image image;
	}
}